<template>
  <div>
    <yl-table :infos="infos" @showDetails="showDetails"></yl-table>
    <yl-details :person='person' :edit='edit' @close="edit=true"></yl-details>
  </div>
</template>

<script>
import YlDetails from './components/yl-details.vue'
import YlTable from './components/yl-table.vue'
export default {
  components: { YlDetails, YlTable },
  data() {
    return {
      infos: [
        {
          date: '2022-01-01',
          doctor: '张三',
          diagnosis: '感冒',
          prescription: '感冒药',
        },
        {
          date: '2022-02-01',
          doctor: '李四',
          diagnosis: '头疼',
          prescription: '止疼药',
        },
        {
          date: '2022-03-01',
          doctor: '王五',
          diagnosis: '腰痛',
          prescription: '止痛贴',
        },
      ],
      edit: true,
      person: {},
    }
  },
  methods: {
    showDetails(item) {
      this.person = item
      this.edit = false
    },
  },
}
</script>

<style>
</style>
